home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000008_icon-group-sender _Sun Jul 11 13:53:35 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Sun, 11 Jul 1993 12:58:27 MST
  2. Date: Sun, 11 Jul 93 13:53:35 CDT
  3. From: "Richard L. Goerwitz" <goer@midway.uchicago.edu>
  4. Message-Id: <9307111853.AA17772@midway.uchicago.edu>
  5. To: Paul_Abrahams@mts.cc.wayne.edu
  6. Subject: Re:  Sort enhancements for records and lists
  7. Cc: icon-group@cs.arizona.edu
  8. Status: R
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11. >The obvious rule for sorting lists is that they are sorted by their first
  12. >element; within equal first elements, by their second element, and so
  13. >forth.  This simple extension would provide multi-field sorting,
  14. >something that many people have requested.
  15.  
  16. There is a function, sortf, that sorts on a requested field.  I wrote
  17. a procedure a while back that will sort on arbitrarily many fields, in
  18. order.  It's called sortff().  If, say, you want lists sorted on field
  19. 3, then (if several lists have the same field 3) on field 4, you'd say
  20. sortff(l, 3, 4).  If anyone wants me to post sortff() will do so.  It
  21. is not very long.
  22.  
  23. Full recursive sorts on all structures tend to be expensive, and only
  24. rarely necessary (in my experience).
  25.  
  26. Paul, I'm like you in the sense that I treat the sort order for struc-
  27. tures as undefined, even though a version or so ago the Icon Project
  28. define a full sort order for all objects.
  29.  
  30. -Richard
  31.  goer@midway.uchicago.edu
  32.